<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing: display a admin toolbar button
 *
 * @category   	Joomzf Cms
 * @package    	View
 * @copyright  	Copyright vinanewstar.vn@gmail.com
 * @author		GiangNam (vinanewstar.vn@gmail.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 May 28, 2012 - 3:26:53 PM
 */
class Joomzf_View_Helper_ToolbarButton extends Zend_View_Helper_Abstract{
	public function toolbarButton($name,$value = '#',$attribs = null,$options = null ){
		$view= $this->view;
		if ($options['name'] !== "divider"){
				
	
			$name = $view->translate($options['name']);
			if($needCheck = $options['needCheck'] == 1) $needCheckMsg = $view->translate($options['needCheckMsg']); else{
				$needCheckMsg = " ";
				$needCheck = 0;
			}
			if($needConfirm = $options['needConfirm'] == 1) $needConfirmMsg = $view->translate($options['needConfirmMsg']);else {
				$needConfirmMsg =" ";
				$needConfirm = 0;
			}
	
			$classIcon = $options['iconClass'];
			if(empty($classIcon)) $classIcon = 'icon-32-default';
			$link=$value;
			if($options['buttonType'] == 'submit'){
				$link = "javascript:toolbarButtonSubmit('" .  $link . "','".$needCheck."','".$needCheckMsg."','".$needConfirm."','".$needConfirmMsg."')";
			}
	
			$xhtml = '<li class="button" id="toolbar-'.$name.'">
			<a href="' . $link . '" class="toolbar">
			<span class="'.$classIcon.'"></span>
			' . $name . '
			</a>
			</li>';
		}else
			$xhtml = '<li class="divider" ></li>';
		return $xhtml;
	}
}